<!-- 变更申请 -->
<template>
  <a-popover v-model="popoverVisible" trigger="click">
    <template slot="title">
      <span>变更申请</span>
    </template>
    <template slot="content">
      <div class="content-box">
        <div v-for="item in formList" :key="item.value" :class="['select-item', item.isSelect ? 'selected' : '']" @click="itemClick(item)">
          <a-checkbox v-model="item.isSelect"></a-checkbox><span class="ml-10">{{ item.label }}</span>
        </div>
        <div class="footer-box">
          <a-button type="primary" @click="onConfirm">确认</a-button>
          <a-button @click="onCancel">取消</a-button>
        </div>
      </div>
    </template>
    <a-button type="primary" @click="onAlterApply">变更申请</a-button>
  </a-popover>
</template>

<script>
export default {
  name: 'AlterApply',
  data() {
    return {
      popoverVisible: false,
      formList: [
        { label: '基本资料', value: 'base', isSelect: false },
        { label: '收款信息', value: 'col', isSelect: false },
        { label: '工商信息', value: 'ic', isSelect: false },
      ]
    };
  },
  mounted() {
  },
  methods: {
    onAlterApply() {
      this.formList.forEach(item => item.isSelect = false);
    },
    itemClick(item) {
      item.isSelect = !item.isSelect;
    },
    onConfirm() {
      this.$emit('alterApply', this.formList);
      this.popoverVisible = false;
    },
    onCancel() {
      this.popoverVisible = false;
    }
  }
}
</script>

<style lang="less" scoped>
.content-box {
}

.select-item {
  height: 40px;
  line-height: 40px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid #BBBBBB;
  margin-bottom: 10px;
  cursor: pointer;
}
.selected {
  color: #1F7FE3;
  border: 1px solid #1F7FE3;
}
.footer-box {
  display: flex;
  justify-content: space-between;
}
</style>